package com.evil.application.api;

import com.evil.application.config.FeignErrorDecoder;
import com.evil.application.pojo.dto.form.control.ControlBaseInfoDTO;
import com.evil.application.pojo.dto.reporting.data.ReportingDataReqDTO;
import com.evil.application.pojo.dto.reporting.data.ReportingDataRespDTO;
import com.evil.application.pojo.dto.reporting.data.list.ReportingDataListReqDTO;
import com.evil.common.application.dto.order.OrderPageDataRespDTO;
import com.evil.common.core.constant.ServiceNameConstant;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * 应用报表数据接口
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@FeignClient(name = ServiceNameConstant.APPLICATION_SERVICE, configuration = {FeignErrorDecoder.class})
public interface RemoteApplicationReportingDataService {

    /**
     * 应用报表数据
     *
     * @param reportingDataReqDTO reportingDataReqDTO
     * @return ReportingDataRespDTO
     */
    @PostMapping("/remote/application/reporting/data")
    ReportingDataRespDTO reportingData(@Validated @RequestBody ReportingDataReqDTO reportingDataReqDTO);

    /**
     * 应用报表可见控件 基础信息
     *
     * @param reportingKey reportingKey
     * @return List
     */
    @PostMapping("/remote/application/reporting/visible/control")
    List<ControlBaseInfoDTO> reportingVisibleControlsBases(@RequestParam("reportingKey") @NotBlank(message = "报表key不能为空") String reportingKey);

    /**
     * 应用报表数据
     *
     * @param reportingDataListReqDTO reportingDataListReqDTO
     * @return ReportingDataRespDTO
     */
    @PostMapping("/remote/application/reporting/data/list")
    PageInfo<OrderPageDataRespDTO> reportingDataList(@Validated @RequestBody ReportingDataListReqDTO reportingDataListReqDTO);
}
